<template>
  <div class="pickerBox">
    <CalendarMutilPicker ref="Picker" :date="date" :initalValue="initalValue" class="picker"></CalendarMutilPicker>
    <div :style="{ position: 'absolute', left: 0, bottom: 0, right: 0, zIndex: 9, borderTop: '1px solid #e9e9e9', padding: '10px 20px', background: '#fff', textAlign: 'right' }">
      <el-button @click="closeHandler">取 消</el-button>
      <AjaxButton size="small" type="primary" :click="saveHandle" class="bTn">保存</AjaxButton>
    </div>
  </div>
</template>
<script>
/**
 * 维护技师排班表 - 详情
 * 芦小星
 */
import { dictionary } from '@/utils/dictMixin';
import { PersonList, saveList } from '@/api/repair/workshopManagement/technicianScheduling/index';
export default {
  name: 'lxxTechnicianSchedulingDetail',
  mixins: [dictionary],
  props: ['rowData', 'date', 'initalValue'],
  data() {
    return {
      saveData: [],
      queryParam: {}
    };
  },
  created() {
    // this.searchList();
  },
  mounted() {
    console.log(typeof this.rowData, 'this.initalValue=>edit');
  },
  methods: {
    async saveHandle() {
      let saveData = this.$refs.Picker.GET_DATA();
      this.queryParam.ON_DUTY = saveData;
      this.queryParam.CREATED_AT = this.date;
      this.queryParam.USER_ID = this.rowData.USER_ID;
      this.queryParam.WORKGROUP_ID = this.rowData.WORKGROUP_ID;
      console.log(this.queryParam);
      const res = await saveList({ ...this.queryParam });
      console.log(JSON.stringify(res), 444);
      if (res.resultCode == 200) {
        this.closeHandler();
        this.$message({
          message: '保存成功',
          type: 'success'
        });
      }
    },
    closeHandler(param) {
      this.$emit('close', false, param);
    }
  }
};
</script>
<style scoped>
.pickerBox {
  width: 100%;
  background-size: 200%;
  background-repeat: no-repeat;
  background-color: #fff;
}
/* assets/img/login_bg.svg */
.picker {
  margin-left: 10px;
  margin-bottom: 10px;
}
</style>
